<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="合同名称" prop="contractName">
        <el-input
          v-model="queryParams.contractName"
          placeholder="请输入合同名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
        <el-form-item label="合同对象" prop="projectId">
          <el-select v-model="queryParams.contractCounterpart" clearable style="width: 200px;"placeholder="请选择合同对象">
            <el-option
              v-for="item in counterpartList"
              :key="item.id"
              :label="item.name"
              :value="item.id">
            </el-option>
          </el-select>
        </el-form-item>
      <el-form-item  label="合同类型" prop="projectId">
          <el-select v-model="queryParams.contractType" clearable style="width: 200px;"  placeholder="请选择合同类型">
            <el-option
              v-for="item in contractTypeOptions"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="部门" prop="deptId">
        <treeselect style="width: 200px;" v-model="queryParams.deptId" :options="deptOptions" :normalizer="normalizer" placeholder="选择部门" />
      </el-form-item>
      <el-form-item label="生效日期" prop="effectiveDate" >
        <el-date-picker clearable
                        v-model="queryParams.effectiveDate"
                        type="date"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择生效日期" style="width: 200px;">
        </el-date-picker>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>

    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" show-overflow-tooltip border :data="manageList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="合同名称"  width="100px" align="center" prop="contractName" show-overflow-tooltip center/>
      <el-table-column label="合同对象" width="100px"  align="center" prop="counterpartName" show-overflow-tooltip center/>
      <el-table-column label="合同编码" width="100px"  align="center" prop="contractNo" show-overflow-tooltip center/>
      <el-table-column label="合同金额" width="100px"  align="center" prop="contractAmount" show-overflow-tooltip center/>
      <el-table-column label="合同类型" align="center" prop="contractType" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span v-if="scope.row.contractType == '1'">销售合同</span>
          <span v-if="scope.row.contractType == '2'">采购合同</span>
        </template>
      </el-table-column>
      <el-table-column label="金额类型" width="100px"  align="center" prop="amountType" show-overflow-tooltip center/>
      <el-table-column label="负责人" width="100px"  align="center" prop="responsible" show-overflow-tooltip center/>
      <el-table-column label="部门" width="100px"  align="center" prop="deptName" show-overflow-tooltip center/>
      <el-table-column label="签署状态" width="100px"  align="center" prop="signStatus" show-overflow-tooltip center >
        <template slot-scope="scope">
          <span v-if="scope.row.signStatus == '0'">未签署</span>
          <span v-if="scope.row.signStatus == '1'">已签署</span>
        </template>
      </el-table-column>
      <el-table-column label="签订状态" width="100px"  align="center" prop="signState" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span v-if="scope.row.signState == '0'">未签订</span>
          <span v-if="scope.row.signState == '1'">已签订</span>
        </template>
      </el-table-column>
      <el-table-column label="生效日期"  align="center" prop="effectiveDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.effectiveDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="有效日期" align="center" prop="validDate" width="180" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.validDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="签订日期" align="center" prop="signDate" width="180" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.signDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="归档日期" align="center" prop="fileDate" width="180" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.fileDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>

      <el-table-column label="账款金额" align="center" prop="amountAccount" show-overflow-tooltip center/>
      <el-table-column label="待回/待付金额" width="120px" align="center" prop="waitAmount" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span>{{ scope.row.contractAmount - scope.row.amountAccount }}</span>
        </template>
      </el-table-column>
      <el-table-column label="计划回/付款"  width="120px" align="center" prop="playAmount" show-overflow-tooltip center/>
      <el-table-column label="开票金额" align="center" prop="invoiceAmount" show-overflow-tooltip center/>
      <el-table-column label="待收/开票" align="center" prop="waitInvoiceAmount" show-overflow-tooltip center>
        <template slot-scope="scope">
          <span>{{ scope.row.contractAmount - scope.row.invoiceAmount }}</span>
        </template>
      </el-table-column>
      <el-table-column  fixed="right"  label="操作" width="170" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
          >删除</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-info"
            @click="handleInfo(scope.row)"
          >详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改【请填写功能名称】对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row :gutter="15">
          <el-col :span="12">
            <el-form-item label-width="120px" label="合同名称" prop="contractName">
              <el-input v-model="form.contractName" style="width: 300px;" placeholder="请输入合同名称" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="合同类型" prop="contractName">
              <el-select v-model="form.contractType" style="width: 300px;"  placeholder="请选择合同类型">
                <el-option
                  v-for="item in contractTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="合同对象" prop="contractCounterpart">
              <el-select v-model="form.contractCounterpart" style="width: 300px;"  placeholder="请选择合同对象">
                <el-option
                  v-for="item in counterpartList"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="合同编码" prop="contractNo">
              <el-input v-model="form.contractNo" style="width: 300px;" placeholder="请输入合同编码" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="合同金额" prop="contractAmount">
              <el-input v-model="form.contractAmount" style="width: 300px;" placeholder="请输入合同金额" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="负责人" prop="responsible">
              <el-input v-model="form.responsible" style="width: 300px;" placeholder="请输入负责人" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="生效日期" prop="effectiveDate" >
              <el-date-picker clearable
                              v-model="form.effectiveDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择生效日期" style="width: 300px;">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label-width="120px" label="有效日期" prop="validDate">
              <el-date-picker clearable
                              v-model="form.validDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择有效日期"
                              style="width: 300px;"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="updateFlag">
            <el-switch
              style="margin-left: 45px"
              v-model="form.signState"
              active-text="已签订"
              inactive-text="未签订"
            >
            </el-switch>
          </el-col>
          <el-col :span="12" v-if="updateFlag">
            <el-form-item label-width="120px" label="签订日期" prop="signDate">
              <el-date-picker clearable
                              v-model="form.signDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              style="width: 300px;"
                              placeholder="请选择签订日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="updateFlag">

            <el-switch
              style="margin-left: 45px"

              v-model="form.signStatus"
              active-text="已归档"
              inactive-text="未归档"
            >
            </el-switch>
          </el-col>
          <el-col :span="12" v-if="updateFlag">

            <el-form-item label-width="120px" label="归档日期" prop="fileDate">
              <el-date-picker clearable
                              v-model="form.fileDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              style="width: 300px;"
                              placeholder="请选择归档日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label-width="120px" label="部门" prop="deptId">
              <treeselect style="width: 300px;" v-model="form.deptId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label-width="120px" label="关联合同" prop="manageDataList">
              <el-select multiple v-model="form.manageDataList" filterable placeholder="请选择" @remove-tag="removeRelation" style="width: 300px;">
                <el-option
                  v-for="item in manageDataList"
                  :key="item.id"
                  :label="item.contractName+'-'+item.id"
                  :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

          <el-row :gutter="15">
            <el-col :span="12">
              <el-form-item label-width="120px">
                <el-upload
                  class="upload-demo"
                  :action="upload.url"
                  :headers="upload.headers"
                  :on-preview="handlePreview"
                  :on-remove="handleRemove"
                  :before-remove="beforeRemove"
                  :on-progress="handleFileUploadProgress"
                  :on-success="handleFileSuccess"
                  multiple
                  :limit="10"
                  :on-exceed="handleExceed"
                  :file-list="fileList">
                  <el-button size="small" type="primary">上传附件</el-button>
                </el-upload>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog title="详情" :visible.sync="openInfo" width="1000px" append-to-body>
      <el-tabs type="border-card">
        <el-tab-pane label="账款计划">
          <el-table show-overflow-tooltip border :data="planAmountsList">
            <el-table-column label="期次" align="center" prop="qc" >
              <template slot-scope="scope">
                <span>{{scope.row.qc}}期</span>
              </template>
            </el-table-column>
            <el-table-column label="合同" align="center" prop="contractName" />
            <el-table-column label="计划金额" align="center" prop="planAmount" />
            <el-table-column label="计划日期" align="center" prop="planDate" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.planDate, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="发票记录">
          <el-table show-overflow-tooltip border :data="invoicesList">

            <el-table-column label="相对方"  align="center" prop="counterpartName" width="130"/>
            <el-table-column label="合同" align="center" prop="contractName" width="130"/>
            <el-table-column label="发票类型" align="center" prop="invoiceType" width="130"/>
            <el-table-column label="发票金额" align="center" prop="invoiceAmount" width="130"/>
            <el-table-column label="税率" align="center" prop="taxRate" width="130">
              <template slot-scope="scope">
                <span>{{scope.row.taxRate}}%</span>

              </template>
            </el-table-column>
            <el-table-column label="发票日期" align="center" prop="invoiceDate" width="180">
              <template slot-scope="scope">
                <span>{{ parseTime(scope.row.invoiceDate, '{y}-{m}-{d}') }}</span>
              </template>
            </el-table-column>
            <el-table-column label="发票内容" align="center" prop="invoiceDesc"width="130" show-overflow-tooltip center/>
            <el-table-column label="备注" align="center" prop="remarks" width="130" show-overflow-tooltip center/>
            <el-table-column label="发票抬头" align="center" prop="invoiceTitle" width="130" show-overflow-tooltip center/>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="关联合同">
          <el-table show-overflow-tooltip border :data="contractList" >
            <el-table-column label="合同名称"   align="center" prop="contractName" show-overflow-tooltip center/>
            <el-table-column label="合同对象"  align="center" prop="counterpartName" show-overflow-tooltip center/>
            <el-table-column label="合同编码"   align="center" prop="contractNo" show-overflow-tooltip center/>
            <el-table-column label="金额类型"   align="center" prop="amountType" show-overflow-tooltip center/>
            <el-table-column label="合同金额"   align="center" prop="contractAmount" show-overflow-tooltip center/>
            <el-table-column label="负责人" align="center" prop="responsible" show-overflow-tooltip center/>
            <el-table-column label="部门" width="100px"  align="center" prop="deptName" show-overflow-tooltip center/>
            <el-table-column label="签署状态"   align="center" prop="signStatus" show-overflow-tooltip center >
              <template slot-scope="scope">
                <span v-if="scope.row.signStatus == '0'">未签署</span>
                <span v-if="scope.row.signStatus == '1'">已签署</span>
              </template>
            </el-table-column>
          </el-table>

        </el-tab-pane>
      </el-tabs>
    </el-dialog>
  </div>
</template>

<script>
import { listManage, getManage, delManage, addManage, updateManage,listManageAll,getContractInfo,removeRelations } from "@/api/contract/manage";
import {listCounterpartAll} from "@/api/contract/counterpart";
import {listDept, listDeptExcludeChild} from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import {getToken} from "@/utils/auth";
import { listAllProject} from "@/api/contract/project";

export default {
  name: "ContractManage",
  components: { Treeselect },

  data() {
    return {
      openInfo:false,
      totalCon: 0,
      // 查询参数
      queryParamsCon: {
        pageNum: 1,
        pageSize: 10,
      },
      openContract:false,
      fileList:[],
      manageDataList:[],
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/common/upload"
      },
      contractNamesFrom:[],
      baseUrl:process.env.VUE_APP_BASE_API,
      contractTypeOptions:[
        {
          value: '1',
          label: '销售合同'
        },{
          value: '2',
          label: '采购合同'
        },
      ],
      // 遮罩层
      loading: true,
      updateFlag: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      manageList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      fileNameList:[],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        contractName: null,
        contractCounterpart: null,
        contractNo: null,
        amountType: null,
        currencyType: null,
        contractAmount: null,
        responsible: null,
        deptId: null,
        signStatus: null,
        fulfilStatus: null,
        effectiveDate: null,
        validDate: null,
        signDate: null,
        fileDate: null,
        contractType: null,
        amountAccount: null,
        waitAmount: null,
        playAmount: null,
        invoiceAmount: null,
        waitInvoiceAmount: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      counterpartList:[],
      deptOptions:[],
      contractNames:[],
      conIds:[],
      contractList:[],
      planAmountsList:[],
      invoicesList:[],

    };
  },
  activated() {
    this.getList();
  },
  created() {
    this.getList();
    this.init();
  },

  methods: {
    init() {
      listCounterpartAll({}).then( res =>{
        this.counterpartList = res.data;
      })

      listDept().then(response => {
        this.deptOptions = this.handleTree(response.data, "deptId");
      });
    },
    removeRelation(tag){
      debugger
      var data = {contractId:this.form.id,contractRelationId:tag}
      console.log(data)

      removeRelations(data).then(res =>{
        this.$modal.msgSuccess("取消成功");

      })

    },
    handleInfo(row){
      getContractInfo({id:row.id}).then(res =>{
        //合同信息
        this.contractList = res.data.contract;
        //账款计划
        this.planAmountsList = res.data.planAmounts;
        //发票信息
        this.invoicesList = res.data.invoices;
      })
      this.openInfo = true;
    },
    handleAddCon(){
      this.openContract = false;
      this.conIdsFrom = this.conIds
      this.contractNamesFrom = this.contractNames
    },
    addContract(){
      listManageAll({}).then(response => {
        this.manageDataList = response.data;
      });
    },
    handleSelectionConChange(selection) {
      this.conIds = selection.map(item => item.id)
      this.contractNames = selection.map(item => item.contractName)

    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      debugger
      console.log(response)
      if(response.code == 200){
        this.fileNameList.push(response.fileName)
      }

    },
    handleRemove(file, fileList) {
      if(file.hasOwnProperty('response')){
        this.fileNameList = this.fileNameList.filter(function(value) {
          return value !== file.response.url;
        });

      }
      if(file.hasOwnProperty('url')){
        this.fileNameList = this.fileNameList.filter(function(value) {
          return value !== file.url;
        });
      }
    },
    handlePreview(file) {
      if(file.hasOwnProperty('response')){
        window.open(file.response.url)
      }
      if(file.hasOwnProperty('url')){
        window.open(this.baseUrl+file.url)
      }
    },
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 10 个文件，本次选择了 ${files.length} 个文件，共选择了 ${files.length + fileList.length} 个文件`);
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${ file.name }？`);
    },
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listManage(this.queryParams).then(response => {
        this.manageList = response.rows;
        this.total = response.total;
        this.loading = false;
      });

    },

    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.fileList = []
      this.fileNameList = []
      this.form = {
        id: null,
        contractName: null,
        contractCounterpart: null,
        contractNo: null,
        amountType: null,
        currencyType: null,
        contractAmount: null,
        responsible: null,
        deptId: null,
        signStatus: null,
        fulfilStatus: null,
        effectiveDate: null,
        validDate: null,
        signDate: null,
        fileDate: null,
        contractType: null,
        amountAccount: null,
        waitAmount: null,
        playAmount: null,
        invoiceAmount: null,
        waitInvoiceAmount: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 转换部门数据结构 */
    normalizer(node) {
      if (node.children && !node.children.length) {
        delete node.children;
      }
      return {
        id: node.deptId,
        label: node.deptName,
        children: node.children
      };
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.updateFlag = false

      this.reset();
      this.open = true;
      this.title = "合同属性";
      this.addContract()
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.updateFlag = true
      this.addContract()
      this.reset();
      const id = row.id || this.ids
      getManage(id).then(response => {
        this.form = response.data;
        this.form.signState = this.form.signState == '1' ? true : false;
        this.form.signStatus = this.form.signStatus == '1' ? true : false;
        if(this.form.fileList){
          this.fileList = this.form.fileList;
        }
        listCounterpartAll({}).then( res =>{
          this.counterpartList = res.data;
        })
        console.log("this.form.fileNameList"+this.form.fileNameList)
        if(this.form.fileNameList){
          this.fileNameList = this.form.fileNameList
        }
        this.open = true;
        this.title = "合同属性";
        listDept().then(response => {
          this.deptOptions = this.handleTree(response.data, "deptId");
        });

      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.signState = this.form.signState ? '1' : '0';
          this.form.signStatus = this.form.signStatus ? '1' : '0';
          this.form.fileNameList = this.fileNameList
          if (this.form.id != null) {
            updateManage(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addManage(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除【请填写功能名称】编号为"' + ids + '"的数据项？').then(function() {
        return delManage(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('contract/manage/export', {
        ...this.queryParams
      }, `manage_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
